package com.chenchao.javainnerclass;
/**
 * @encoding : UTF-8
 * @Time : 2020/11/10 17:26
 * @Author : Chen Chao
 * @File : javaSE.com.chenchao.javainnerclass.Test4.java
 * @Software : IntelliJ IDEA
 * @since : 1.8
 * 匿名内部类，父类或者接口
 */
public class Test4 {
    public static void main(String[] args) {
        Computer computer = new Computer();
        computer.readData(new Usbable() {
            @Override
            public void getData() {
                System.out.println("我是匿名内部类");
            }
        });
    }
}
interface Usbable{
    void getData();
}
class Computer {
    public void readData(Usbable usbable){
        usbable.getData();
    }
}